import {IVector3} from "./types";
import {Matrix4} from "./Matrix4";

export class MatrixUtil {
    static composeObjectMatrix(position: IVector3, scale: IVector3, rotation: IVector3): Matrix4 {
        const rx = new Matrix4().makeRotationX(rotation.x);
        const ry = new Matrix4().makeRotationX(rotation.y);
        const rz = new Matrix4().makeRotationX(rotation.z);
        const scaleMatrix = new Matrix4().makeScale(scale.x, scale.y, scale.z);
        const transform = new Matrix4().makeTranslation(position.x,position.y, position.z);
        return transform.multiply(scaleMatrix).multiply(rz).multiply(ry).multiply(rx);
    }

}